{% extends 'base.html' %}
{% block main %}
    <div class="layui-row">
        <div class="layui-col-md12">
            <div class="layui-tab layui-tab-card" lay-filter="publish">
                <ul class="layui-tab-title">
                    <li class="layui-this" lay-id="post">发布</li>
                    <li lay-id="topic">创建话题</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <form class="layui-form layui-row layui-col-space10 layui-form-pane" id="postForm">
                            <div class="layui-col-md8 layui-col-xs12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">标题</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="title" required="" lay-verify="title"
                                               placeholder="请输入标题" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">内容</label>
                                    <div class="layui-input-block">
                                        <textarea placeholder="请输入内容" class="layui-textarea" name="content" id="content"
                                                  lay-verify="content"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md4 layui-col-xs12">
                                <blockquote class="layui-elem-quote title"><i class="seraph icon-caidan"></i> 类目
                                </blockquote>
                                <div class="layui-form-item">
                                    <input type="radio" name="type_id" value="0" title="无类目" checked>

                                    {% for type in types %}
                                        <input type="radio" name="type_id" value="{{ type.id }}"
                                               title="{{ type.name }}">
                                    {% endfor %}
                                </div>
                                <blockquote class="layui-elem-quote title"><i class="seraph icon-caidan"></i> 话题
                                </blockquote>
                                <div class="layui-form-item">
                                    <select name="topic_id" lay-search>
                                        <option value="0">无话题</option>
                                        {% for topic in topics %}
                                            <option value="{{ topic.tid }}">{{ topic.title }}</option>
                                        {% endfor %}

                                    </select>
                                </div>
                                <blockquote class="layui-elem-quote title magt10">发布
                                </blockquote>
                                <div class="layui-form-item">
                                    <a class="layui-btn layui-btn-fluid" lay-filter="addPost" lay-submit>发布</a>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="layui-tab-item">
                        <form class="layui-form layui-row layui-col-space10 layui-form-pane" id="topicForm">
                            <div class="layui-col-md8 layui-col-xs12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">标题</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="title" required="" lay-verify="title"
                                               placeholder="请输入标题" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">描述</label>
                                    <div class="layui-input-block">
                                        <textarea placeholder="请输入描述" class="layui-textarea" name="desc"
                                                  lay-verify="desc"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md4 layui-col-xs12">
                                <blockquote class="layui-elem-quote title magt10">话题
                                </blockquote>
                                <div class="layui-form-item">
                                    <a class="layui-btn layui-btn-fluid" lay-filter="addTopic" lay-submit>创建</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
{% block footer %}
    <script src="{% static 'js/cookies.min.js' %}"></script>
    <script src="{% static 'js/publish.min.js' %}"></script>
{% endblock %}